**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"

**# Bookmark #2 Panel A

matrix T = J(8, 3, .)

*Panel A: Share of Below High School

use "$outfile/Table S1.dta",clear
keep if wave==2004

ttest withtap,by(lowedu4)

local belowhs0_mean = r(mu_1)
local belowhs1_mean = r(mu_2)
local belowhsdiff_mean = r(mu_1) - r(mu_2)

matrix T[1,1] = `belowhs0_mean'
matrix T[1,2] = `belowhs1_mean'
matrix T[1,3] = `belowhsdiff_mean'

*Panel A: Share of Below College

use "$outfile/Table S1.dta",clear
keep if wave==2004

ttest withtap,by(lowedu5)

local belowcl0_mean = r(mu_1)
local belowcl1_mean = r(mu_2)
local belowcldiff_mean = r(mu_1) - r(mu_2)

matrix T[2,1] = `belowcl0_mean'
matrix T[2,2] = `belowcl1_mean'
matrix T[2,3] = `belowcldiff_mean'

*Panel A: Share of Rural Hukou Holders

use "$outfile/Table S1.dta",clear
keep if wave==2004

ttest withtap,by(rural)

local rural0_mean = r(mu_1)
local rural1_mean = r(mu_2)
local ruraldiff_mean = r(mu_1) - r(mu_2)

matrix T[3,1] = `rural0_mean'
matrix T[3,2] = `rural1_mean'
matrix T[3,3] = `ruraldiff_mean'

*Panel A: Share of Skilled Occupation Workers

use "$outfile/Table S1.dta",clear
keep if wave==2004

ttest withtap,by(occupation)

local occupation0_mean = r(mu_1)
local occupation1_mean = r(mu_2)
local occupationdiff_mean = r(mu_2) - r(mu_1)

matrix T[4,1] = `occupation1_mean'
matrix T[4,2] = `occupation0_mean'
matrix T[4,3] = `occupationdiff_mean'

**# Bookmark #3 Panel B

*Panel B: Share of Below High School

use "$outfile/Table S1.dta",clear
keep if wave==2009

ttest withtap,by(lowedu4)

local belowhs0_mean = r(mu_1)
local belowhs1_mean = r(mu_2)
local belowhsdiff_mean = r(mu_1) - r(mu_2)

matrix T[5,1] = `belowhs0_mean'
matrix T[5,2] = `belowhs1_mean'
matrix T[5,3] = `belowhsdiff_mean'

*Panel B: Share of Below College

use "$outfile/Table S1.dta",clear
keep if wave==2009

ttest withtap,by(lowedu5)

local belowcl0_mean = r(mu_1)
local belowcl1_mean = r(mu_2)
local belowcldiff_mean = r(mu_1) - r(mu_2)

matrix T[6,1] = `belowcl0_mean'
matrix T[6,2] = `belowcl1_mean'
matrix T[6,3] = `belowcldiff_mean'

*Panel B: Share of Rural Hukou Holders

use "$outfile/Table S1.dta",clear
keep if wave==2009

ttest withtap,by(rural)

local rural0_mean = r(mu_1)
local rural1_mean = r(mu_2)
local ruraldiff_mean = r(mu_1) - r(mu_2)

matrix T[7,1] = `rural0_mean'
matrix T[7,2] = `rural1_mean'
matrix T[7,3] = `ruraldiff_mean'

*Panel B: Share of Skilled Occupation Workers

use "$outfile/Table S1.dta",clear
keep if wave==2009

ttest withtap,by(occupation)

local occupation0_mean = r(mu_1)
local occupation1_mean = r(mu_2)
local occupationdiff_mean = r(mu_2) - r(mu_1)

matrix T[8,1] = `occupation1_mean'
matrix T[8,2] = `occupation0_mean'
matrix T[8,3] = `occupationdiff_mean'

**# Bookmark #4 Combine

matrix list T
svmat T, names(col)
keep c1 c2 c3
drop if c1==.
format c1 c2 c3 %9.3f
